from sqlalchemy import Column, Integer, String, Numeric, DateTime, ForeignKey
from sqlalchemy.sql import func
from ..core.database import Base

class ConsumptionRecord(Base):
    __tablename__ = "consumption_records"
    
    id = Column(Integer, primary_key=True, index=True)
    user_id = Column(Integer, ForeignKey("users.id"), nullable=False)
    card_id = Column(Integer, ForeignKey("stored_value_cards.id"), nullable=False)
    store_id = Column(Integer, ForeignKey("stores.id"), nullable=False)
    amount = Column(Numeric(10, 2), nullable=False)
    description = Column(String(200))
    consumed_at = Column(DateTime(timezone=True), server_default=func.now()) 